package com.leaveworkframework.core.search;

import java.io.Serializable;
import java.util.List;

public class PagingResponseBuilder<T extends Serializable> { 
	private PagingRequest pagingRequest;
	
	private List<T> entities; 
	
	private Long totalRowCount;
	
	public PagingResponseBuilder<T> setTotalRowCount(Long totalRowCount) {
		this.totalRowCount = totalRowCount;
		return this;
	}
	
	public PagingResponseBuilder<T> setEntities(List<T> entities) {
		this.entities = entities;
		return this;
	}
	
	public PagingResponseBuilder<T> setPagingRequest(PagingRequest pagingRequest) {
		this.pagingRequest = pagingRequest;
		return this;
	}
	
	public PagingResponse<T> build() {
		PagingResponse<T> pagingResponse = new PagingResponse<T>(); 
		
		pagingResponse.entities      = this.entities;
		pagingResponse.pagingRequest = this.pagingRequest;
		pagingResponse.pagingRequest.pagination.totalRowCount = totalRowCount;
		
		return pagingResponse; 
	}
}
